package cn.pinming.entity.system;

import cn.pinming.entity.BaseEntity;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;


/**
 * 系统角色表(SysRole)实体类
 *
 * @author makejava
 * @since 2020-02-02 22:21:25
 */
@Data
@Entity
@Table(name = "`sys_role`")
public class SysRole extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 503042399411844185L;
    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 角色名称
     */
    private String name;
    /**
     * 角色类型
     */
    private Integer type;
    /**
     * 描述
     */
    private String explain;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "sys_role_resource", joinColumns = {@JoinColumn(name = "role_id", referencedColumnName = "id")},
            inverseJoinColumns = {@JoinColumn(name = "resource_id", referencedColumnName = "id")})
    private Set<SysResource> sysResourceSet;


}